<template>
  <div id="nav">
    <router-link
      class="tab-bar-item"
      to="/home"
    >
      <div class="icon"><i class="iconfont icon-shouye"></i></div>
      <div>首页</div>
    </router-link>
    <router-link
      class="tab-bar-item"
      to="/category"
    >
      <div class="icon"><i class="iconfont icon-fenlei"></i></div>
      <div>分类</div>
    </router-link>
    <router-link
      class="tab-bar-item"
      to="/shopcart"
    >
      <div class="icon"><i class="iconfont icon-gouwuchezhengpin "></i></div>
      <div>购物车</div>
    </router-link>
    <router-link
      class="tab-bar-item"
      to="/profile"
    >
      <div class="icon"><i class="iconfont icon-yonghu"></i></div>
      <div>我的</div>
    </router-link>
    <span class="badge">{{$store.getters.getAllCount}}</span>
  </div>
</template>
<script>
export default {

}
</script>
<style lang="less" scoped>
#nav {
  background-color: #f6f6f6;
  display: flex;
  position: fixed;
  left: 0;
  right: 0;
  bottom: 0;
  box-shadow: 0 -3px 1px rgba(100, 100, 100, 0.1);

  //商品数量
  .badge {
    position: absolute;
    top: 0;
    left: 250px;
    background: red;
    display: inline-block;
    height: 20px;
    width: 20px;
    border-radius: 50%;
    text-align: center;
    line-height: 20px;
    color: white;
  }

  a {
    color: var(--color-text);
    &.router-link-exact-active {
      color: var(--color-high-text);
    }
  }

  .tab-bar-item {
    flex: 1;
    text-align: center;
    height: 50px;
    font-size: var(--font-size);
  }
  .tab-bar-item .icon {
    width: 24px;
    height: 24px;
    margin-top: 5px;
    vertical-align: middle;
    display: inline-block;
  }
}
</style>
